/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2022-09-29
 * Time:21:53
 */
class Money implements Cloneable{
    int money=10;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
class Person implements Cloneable{
    String name;
    int age;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person tmp=new Person();
        tmp.money=(Money) this.money.clone();
        return tmp;
    }

    Money money=new Money();
}
public class Copy {
    public static void main(String[] args) throws CloneNotSupportedException{
        Person person=new Person();
        Person person1=(Person) person.clone();
        person1.money.money=1;
        System.out.println(person.money.money);
        System.out.println(person1.money.money);

    }
}
